package com.dragon.sdgp.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * @AUTHOR : Dragon_Yang
 * @File : BasicEntity
 * @DESCRIPTION : 基础实体类
 * @DATE : 2023/2/28 11:35
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public abstract class BasicEntity implements Serializable {

    /**
     * 数据ID
     */
    @TableId(type = IdType.AUTO)
    @TableField("id")
    protected Integer id;

    /**
     * 逻辑删除标识：0、未删除； 1、已删除
     */
    @JsonIgnore
    @TableField("is_delete")
    @TableLogic
    protected Integer isDelete;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    protected Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    protected Date updateTime;
}
